package cn.kow.kmall.pojo.vo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @Author: lijun
 * @Description:
 * @Date: Created in 2019-08-05 15:16
 * @Modified By:
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SpecVO {

    /**
     * 规格id
     */
    private Long id;

    /**
     * 规格类目名称
     */
    private String name;

    /**
     *
     */
    private Integer type;

    private Integer sort;

    /**
     * 规格选项
     */
    private List<SpecValue> skuSpecValueList;

    @Data
    public class SpecValue {

        /**
         * 选项id
         */
        private Long id;

        /**
         * 规格id
         */
        private Long skuSpecId;

        /**
         * 选项名称
         */
        private String value;
    }

    public SpecValue initSpecValue(Long id, Long skuSpecId, String value) {
        SpecValue specValue = new SpecValue();
        specValue.setId(id);
        specValue.setSkuSpecId(skuSpecId);
        specValue.setValue(value);
        return specValue;
    }
}
